# -*- coding: utf-8 -*-
from django.db import models
from django.contrib.auth.models import User

class Funcionario(models.Model):
    
    CARGO_CHOICES = (
        (1, 'Gerente'),
        (2, 'Garçom'),
        (3, 'Atendente'),
        (4, 'Cozinheiro'),
    )
    
    user    = models.OneToOneField(User)
    cargo   = models.IntegerField(max_length = 2, choices=CARGO_CHOICES)
    
    def is_garcom(self):
        if(self.cargo == 1):
            return True
        return False
    
    def get_cargo(self):
        return self.CARGO_CHOICES[self.cargo-1][1]
    
    def __unicode__(self):
        return u"%s" % self.user.username
    
    def field_list(self):
        return [('Nome', self.user.username), ('Cargo', self.get_cargo())]
    
    